//
//  YCLUser.swift
//  新浪微博01
//
//  Created by yaochunlin on 16/4/14.
//  Copyright © 2016年 yaochunlin. All rights reserved.
//

import UIKit

class YCLUser: NSObject {
    
    //用户id
    var id:Int = 0
    
    //用户昵称
    var screen_name:String?
    
    //用户头像地址 50*50像素
    var profile_image_url:String?
    
    //verified_type认证类型
    var verified_type:Int = -1 {
    
        didSet{
        
            // 没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
            switch verified_type {
            case 0:
                verifiedImg = UIImage.init(named: "avatar_vip")
            case 2,3,5:
                verifiedImg = UIImage.init(named: "avatar_enterprise_vip")
            case 220:
                verifiedImg = UIImage.init(named: "avatar_grassroot")
            default:
                verifiedImg = nil
            }
        }
    }
    
    //verified_type认证图片
    var verifiedImg: UIImage?
    
    
    //会员等级 1-6级
    var mbrank:Int = 0 {
    
        didSet{
            
            if mbrank > 0 && mbrank <= 6 {
                
                mbrankImg = UIImage.init(named: "common_icon_membership_level\(mbrank)")
            }else{
                
                //防止复用
                mbrankImg = nil
            }  
        }
    }
    
    //会员等级图片
    var mbrankImg: UIImage?
    
    
    //字典转模型
    init(dict: [String : AnyObject]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
    //重写方法
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    
    //打印对象
    override var description: String{
    
        get{
        
            let keys = ["id","screen_name","profile_image_url","verified_type","mbrank"]
            return"\n\t\t 用户模型: \(dictionaryWithValuesForKeys(keys))"
        }
    }
    
    
    
    
    
    
    

}
